import request from '@/utils/request'

// 获取应用列表
export function getAppList(form) {
  console.log("form:"+form)
  return request({
    url: `/application/list`,
    method: 'get',
    params: form
  })
}

// 添加应用
export function editApp(form) {
  return request({
    url: '/application/update',
    method: 'post',
    data: form
  })
}

// 删除应用
export function delApp(id) {
  return request({
    url: `/application/delete?applicationInfoId=${id}`,
    method: 'post'
  })
}

// 获取分类列表
export function getTypeList() {
  return request({
    url: `/category/list`,
    method: 'post'
  })
}

// 添加\修改分类
export function editType(form) {
  return request({
    url: '/category/update',
    method: 'post',
    data: form
  })
}

// 删除分类
export function delType(id) {
  return request({
    url: `/category/delete?categoryId=${id}`,
    method: 'get'
  })
}

//选中的分配列表
export function getSelectApp(data) {
  return request({
    url: `/application/list/role`,
    method: 'get',
    params: data
  })
}

//未选中的分配列表
export function unSelectApp(data) {
  return request({
    url: `/application/list/role/unallocated`,
    method: 'get',
    params: data
  })
}

//分配应用
export function authAppSelect(data) {
  return request({
    url: '/system/role/authUser/apply',
    method: 'post',
    data: data
  })
}

//取消分配
export function authAppCancel(data) {
  return request({
    // url: `/system/role/authUser/apply/cancel?roleId=${form.roleId}&applicationIds=${form.ids}`,
    url: `/system/role/authUser/apply/cancel`,
    method: 'post',
    data: data
  })
}

export function getHomeList() {
  return request({
    url: '/category/apply/info',
    method: 'get'
  })
}

//舆情
export function saveReview(data) {
  return request({
    url: "/review/upload",
    method: 'POST',
    data: data
  })
}

//获取编号
export function getNum() {
  return request({
    url: "/review/num",
    method: 'get'
  })
}

//获取报送记录
export function getReviewList(data) {
  return request({
    url: `/reviewInfo/new/list`,
    method: 'get',
    params: data
  })
}

//获取报送详情
export function getReviewDetail(id) {
  return request({
    url: `/reviewInfo/new/${id}`,
    method: 'get',
  })
}

//下载文件
export function downloadFile(data) {
  return request({
    url: "/common/download/resource",
    method: "post",
    data: data,
    responseType: 'blob',
  })
}

export function uploadFile(data) {
  return request({
    url: "/common/uploads",
    method: "post",
    data: data,
  })
}

export function setAppStatus(data) {
  return request({
    url: "/home/application/install",
    method: "post",
    data: data
  })
}

